﻿<%@ Page Title="" Language="C#" ValidateRequest="false" MasterPageFile="~/Cadastros/Site.Master" AutoEventWireup="true" CodeBehind="GerenciamentoOS.aspx.cs" Inherits="CongregacaoOs.WebForm.Cadastros.GerenciamentoOS" %>

<%@ Register Src="~/Cadastros/MessageWindow.ascx" TagPrefix="uc1" TagName="MessageWindow" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">

    <link href="../Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet" />
    <script src="Radio/js/jquery.screwdefaultbuttonsV2.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            var activeIndex = parseInt($('#<%=hfIndexAccordion.ClientID %>').val());

            $("#accordion").accordion({
                collapsible: true,
                autoHeight: false,
                navigation: true,
                active: activeIndex,
                change: function (event, ui) {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hfIndexAccordion.ClientID %>').val(index);
                }
            });
        });

        $(function () {
            $("#txtDataInicioBuscar").datepicker({

                changeMonth: false,
                numberOfMonths: 1,
                buttonImage: "dock/jqueryui/images/calendar.gif",
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDatafimBuscar").datepicker("option", "minDate", selectedDate);
                }
            });

            $("#txtDatafimBuscar").datepicker({
                defaultDate: "+1w",
                changeMonth: false,
                numberOfMonths: 1,
                buttonImage: "dock/jqueryui/images/calendar.gif",
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDataInicioBuscar").datepicker("option", "maxDate", selectedDate);
                }
            });

            $("#txtDataPrazo").datepicker({
                defaultDate: "+1w",
                changeMonth: false,
                numberOfMonths: 1,
                buttonImage: "dock/jqueryui/images/calendar.gif",
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDataInicioBuscar").datepicker("option", "maxDate", selectedDate);
                }
            });


        });



    </script>

    <link href="../Content/NewTheme/gridView.css" rel="stylesheet" />
    <style type="text/css">
        .auto-style13 {
            width: 208px;
        }

        .auto-style18 {
            width: 410px;
        }


        .radioStatusFiltro label {
            display: block;
        }

        .radioStatusFiltro td {
            text-align: left;
            width: 20px;
        }

        .auto-style20 {
            width: 88px;
        }

        .auto-style21 {
            width: 70px;
        }
    </style>
    <link href="Comp/HtmlTextEditor/jquery-te-1.4.0.css" rel="stylesheet" />
    <script src="Comp/HtmlTextEditor/jquery-te-1.4.0.min.js"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:HiddenField ID="hfIndexAccordion" runat="server" />
    <uc1:MessageWindow runat="server" ID="MessageWindow" />
    <div id="accordion">
        <h3><a href="#">Consultar</a></h3>
        <div>
            <asp:Panel runat="server" ID="pnlView" Style="width: 90%; margin: 0 auto;">
                <h2>Ordem de Serviço</h2>
                <hr />
                <br />
                <table style="width: 100%">
                    <tr>
                        <td class="auto-style13">Código:<br />
                            <asp:TextBox runat="server" ID="txtCodigoBuscar" placeholder="Código da O.S" Width="100%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>Intervalo:<br />
                            <asp:TextBox runat="server" ID="txtDataInicioBuscar" placeholder="Data Início" ClientIDMode='Static' Width="200px"></asp:TextBox>
                            <asp:TextBox runat="server" ID="txtDatafimBuscar" placeholder="Data Fim" ClientIDMode='Static' Width="200px"></asp:TextBox><br />
                        </td>
                    </tr>
                </table>

                <tr>
                    <td class="auto-style18">Status:<br />
                        <asp:RadioButtonList ID="radioStatusFiltro" AutoPostBack="true" runat="server" ToolTip="Status da O.S" OnSelectedIndexChanged="radioStatusFiltro_SelectedIndexChanged" RepeatLayout="UnorderedList">
                            <asp:ListItem Value="0">Aguardando</asp:ListItem>
                            <asp:ListItem Value="1">Atendimento</asp:ListItem>
                            <asp:ListItem Value="2">Concluída</asp:ListItem>
                            <asp:ListItem Value="3" Selected="True">Todas</asp:ListItem>
                        </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td>


                        <asp:GridView ID="gvOs" runat="server" Style="font-size: smaller; width: 100%"
                            AutoGenerateColumns="False"
                            GridLines="None"
                            AllowPaging="True"
                            CssClass="mGrid"
                            PagerStyle-CssClass="pgr"
                            AlternatingRowStyle-CssClass="alt" OnRowCommand="gvOs_RowCommand" OnRowDataBound="gvOs_RowDataBound" PageSize="7" OnPageIndexChanging="gvOs_PageIndexChanging">
                            <AlternatingRowStyle CssClass="alt" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Edit.png" CommandName="EDITAR" ToolTip="Editar O.S" runat="server" Width="20px" ID="imgEditar" />
                                        &nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ImageUrl="../Images/forum.png" runat="server" CommandName="FORUM" ToolTip="Fórum" Width="20px" ID="imgForum" />

                                        <%--Dados Gerais da O.S--%>
                                        <asp:HiddenField ID="hdIdOs" runat="server" Value="<%# Bind('idOs') %>" />
                                        <asp:HiddenField ID="hdCodigo" runat="server" Value="<%# Bind('codigo') %>" />
                                        <asp:HiddenField ID="hdDataCriacao" runat="server" Value="<%# Bind('dataCriacao') %>" />
                                        <asp:HiddenField ID="hdTitulo" runat="server" Value="<%# Bind('titulo') %>" />
                                        <asp:HiddenField ID="hdTexto" runat="server" Value="<%# Bind('texto') %>" />
                                        <asp:HiddenField ID="hdStatus" runat="server" Value="<%# Bind('status') %>" />
                                        <asp:HiddenField ID="hdDataPrazo" runat="server" Value="<%# Bind('dataprazo') %>" />
                                        <asp:HiddenField ID="hdTipoOs" runat="server" Value="<%# Bind('tipoOs') %>" />
                                        <%--Dados Quem Gerou a O.S--%>
                                        <asp:HiddenField ID="hdIdUsuarioIn" runat="server" Value="<%# Bind('IdUsuarioIn') %>" />
                                        <asp:HiddenField ID="hdRegionalIn" runat="server" Value="<%# Bind('RegionalIn') %>" />
                                        <asp:HiddenField ID="hdDistritalIn" runat="server" Value="<%# Bind('DistritalIn') %>" />
                                        <asp:HiddenField ID="hdAdmIn" runat="server" Value="<%# Bind('AdmIn') %>" />
                                        <asp:HiddenField ID="hdCidadeIn" runat="server" Value="<%# Bind('CidadeIn') %>" />
                                        <%--Quem Executará a O.S--%>
                                        <asp:HiddenField ID="hdRegionalOut" runat="server" Value="<%# Bind('RegionalOut') %>" />
                                        <asp:HiddenField ID="hdDistritalOut" runat="server" Value="<%# Bind('DistritalOut') %>" />
                                        <asp:HiddenField ID="hdAdmOut" runat="server" Value="<%# Bind('AdmOut') %>" />
                                        <asp:HiddenField ID="hdCidadeOut" runat="server" Value="<%# Bind('CidadeOut') %>" />
                                        <asp:HiddenField ID="hdSetorOut" runat="server" Value="<%# Bind('SetorOut') %>" />
                                        <asp:HiddenField ID="hdAnexo" runat="server" Value="<%# Bind('anexo') %>" />
                                        <asp:HiddenField ID="hdServoQExecutara" runat="server" Value="<%# Bind('idServoQExecutara') %>" />
                                        <asp:HiddenField ID="hdEnviarEmailSetor" runat="server" Value="<%# Bind('EnviarEmailSetor') %>" />


                                    </ItemTemplate>
                                    <ItemStyle Width="11%" HorizontalAlign="Center" VerticalAlign="Middle" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="Codigo" HeaderText="Código" HtmlEncode="False">
                                    <HeaderStyle HorizontalAlign="center" />
                                    <ItemStyle HorizontalAlign="Center" Width="8%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="titulo" HeaderText="Título" HtmlEncode="False">
                                    <HeaderStyle HorizontalAlign="Left" />
                                    <ItemStyle HorizontalAlign="Left" Width="15%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="UsuarioIn" HeaderText="Aberto Por" HtmlEncode="False">
                                    <ItemStyle Width="15%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="AdmIn" HeaderText="Administração" HtmlEncode="false">
                                    <ItemStyle Width="12%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="AdmOut" HeaderText="Dirigida a" HtmlEncode="false">
                                    <ItemStyle Width="15%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="dataPrazo" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Prazo" HtmlEncode="false">
                                    <ItemStyle Width="8%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>

                                <asp:BoundField DataField="TipoOs" HeaderText="TipoOs" HtmlEncode="False">
                                    <ItemStyle Width="2%" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:TemplateField ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:ImageButton runat="server" Width="20px" ID="imgStatus" CommandArgument='<%# Bind("Status") %>' />
                                        <itemstyle width="10%" horizontalalign="Center" />
                                    </ItemTemplate>

                                    <ItemStyle HorizontalAlign="Center" Width="5%"></ItemStyle>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                Nenhum registro encontrado...
                            </EmptyDataTemplate>
                            <PagerStyle CssClass="pgr" />
                        </asp:GridView>
                    </td>
                </tr>

                <table>
                    <tr>
                        <td>

                            <div style="float: right;">
                                <asp:Button ID="btnBuscar" runat="server" Text="Buscar" OnClick="btnBuscar_Click" Width="159px" />
                                <asp:Button ID="btnGerarOs" runat="server" Text="Gerar Nova O.S" Width="159px" OnClick="btnGerarOs_Click" />
                            </div>
                        </td>
                    </tr>
                </table>

            </asp:Panel>



        </div>
        <h3><a href="#">Cadastrar/Editar</a></h3>
        <div>
            <asp:Panel runat="server" ID="Panel1" Style="width: 60%; margin: 0 auto;">
                <div style="width: 100%; margin: 0 auto;">                    
                        <asp:Label Text="" runat="server" ID="lblCodigoID" Style="font-size: xx-large;"></asp:Label><br />
                        <hr />
                      <br />
                        <label><b>Prazo&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:TextBox runat="server" ID="txtDataPrazo" Width="100%" ClientIDMode="Static"></asp:TextBox><br />


                        <label><b>Tipo O.S&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropTipoOS" Width="100%" DataTextField="nome" DataValueField="idTipoOs" runat="server" OnDataBound="dropTipoOS_DataBound"></asp:DropDownList><br />

                        <label><b>Regional&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropRegionalOut" DataTextField="Regional" DataValueField="idRegional" Width="100%" runat="server" AutoPostBack="True" OnDataBound="dropRegionalOut_DataBound" OnSelectedIndexChanged="dropRegionalOut_SelectedIndexChanged"></asp:DropDownList><br />
                        <label><b>Distrital&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropDistritalOut" DataTextField="Distrital" DataValueField="idDistrital" Width="100%" runat="server" AutoPostBack="True" OnDataBound="dropDistritalOut_DataBound" OnSelectedIndexChanged="dropDistritalOut_SelectedIndexChanged"></asp:DropDownList><br />

                        <label><b>Administração&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropAdmOut" DataTextField="adm" DataValueField="idAdm" Width="100%" runat="server" AutoPostBack="True" OnDataBound="dropAdmOut_DataBound" OnSelectedIndexChanged="dropAdmOut_SelectedIndexChanged"></asp:DropDownList><br />
                        <label><b>Cidade&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropCidadeOut" DataTextField="Cidade" DataValueField="idCidade" Width="100%" runat="server" OnDataBound="dropCidadeOut_DataBound" AutoPostBack="True" OnSelectedIndexChanged="dropCidadeOut_SelectedIndexChanged"></asp:DropDownList><br />

                        <label><b>Setor&nbsp;&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:DropDownList ID="dropSetorOut" DataTextField="nome" DataValueField="idSetor" Width="100%" runat="server" OnDataBound="dropSetorOut_DataBound" AutoPostBack="True" OnSelectedIndexChanged="dropSetorOut_SelectedIndexChanged"></asp:DropDownList><br />
                        <label><b>Servo que Executará</b></label><br />
                        <asp:DropDownList ID="dropServoQExecutara" DataTextField="Servo" DataValueField="idServo" Width="100%" runat="server" OnDataBound="dropServoQExecutara_DataBound" AutoPostBack="True" OnSelectedIndexChanged="dropServoQExecutara_SelectedIndexChanged" ValidationGroup="MyFields"></asp:DropDownList><br />
                        <br />

                        <asp:CheckBox ID="checkEnviarEmail" Text="  Enviar e-mail somente para servo que executará" AutoPostBack="True" runat="server" OnCheckedChanged="checkEnviarEmail_CheckedChanged" Font-Bold="True" />
                        <br />
                        <br />

                        <label><b>Título&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:TextBox runat="server" ID="txtTitulo" Width="100%"></asp:TextBox><br />

                        <label><b>Texto&nbsp;&nbsp; </b></label>
                        <br />
                        <asp:TextBox runat="server" ID="txtTexto" Width="100%" TextMode="MultiLine" Height="188px"></asp:TextBox><br />

                        <table>
                            <tr>
                                <td>
                                    <label><b>Anexo</b></label><br />
                                    <asp:FileUpload ID="fileUpLoad" runat="server" Width="342px" />
                                    <br />
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>
                                    <br />
                                    <asp:TextBox runat="server" ID="txtAnexo" Width="342px" Visible="false" Enabled="False"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:ImageButton ID="imgAnexo" ToolTip="Abrir Anexo" Visible="false" runat="server" Height="45px" ImageUrl="../Images/anexo.png" Width="43px" OnClick="imgAnexo_Click" />
                                </td>
                            </tr>
                        </table>



                        <br />

                        <asp:Button ID="btnSalvar" runat="server" Text="Salvar" Width="159px" OnClick="btnSalvar_Click" />
                        <asp:Button ID="btnVoltar" runat="server" Text="Voltar" Width="159px" OnClick="btnVoltar_Click" />
            </asp:Panel>
        </div>
    </div>



</asp:Content>
